//
//  SCNRankingInvestModels.swift
//  ShoucainuSwift
//
//  Created by 王家旭 on 2017/5/15.
//  Copyright © 2017年 Riluee. All rights reserved.
//

import Foundation
import ObjectMapper

// MARK: Invest(投资)

class SCNRankingInvestViewModel: NSObject {
    
    class func requestOtherInvest(_ block:@escaping ((_ dataresult: [SCNRankingInvestListModels]) -> Void)) -> Void {
        
        SCNRequestManager.postRequest([:], URL: SCNRequestAPI.other().invest) { (response) in
            
            let investModels = Mapper<SCNRankingInvestModels>().map(JSONObject: response.result.value)
            
            if let tmp = investModels?.dataresult {
                block(tmp)
                
                
            }
        }
        
        
    }
}

class SCNRankingInvestModels: Mappable {
    var dataresult: [SCNRankingInvestListModels]?
    var errmsg: String?
    var status: Int?
    var servertime: Int?
    
    
    
    
    init(){}
    
    required init?(map: Map) {
        mapping(map:map)
    }
    
    func mapping(map: Map) {
        
        dataresult <- map["dataresult"]
        errmsg <- map["errmsg"]
        status <- map["status"]
        servertime <- map["servertime"]
    }
    
}

class SCNRankingInvestListModels: Mappable {
    
    var account: String?
    var mobile: String?
    
    init(){}
    
    required init?(map: Map) {
        mapping(map:map)
    }
    
    func mapping(map: Map) {
        
        
        account <- map["account"]
        mobile <- map["mobile"]

    }
    
}

// MARK: Integral(金币)

class SCNRankingIntegralViewModel: NSObject {
    
    class func requestOtherIntegral(_ block:@escaping ((_ dataresult: [SCNRankingIntegralListModels]) -> Void)) -> Void {
        
        SCNRequestManager.postRequest([:], URL: SCNRequestAPI.other().integral) { (response) in
            
            let investModels = Mapper<SCNRankingIntegralModels>().map(JSONObject: response.result.value)
            
            if let tmp = investModels {
                block(tmp.dataresult!)
                
                
            }
        }
        
        
    }
}

class SCNRankingIntegralModels: Mappable {
    var dataresult: [SCNRankingIntegralListModels]?
    var errmsg: String?
    var status: Int?
    var servertime: Int?
    
    
    
    
    init(){}
    
    required init?(map: Map) {
        mapping(map:map)
    }
    
    func mapping(map: Map) {
        
        dataresult <- map["dataresult"]
        errmsg <- map["errmsg"]
        status <- map["status"]
        servertime <- map["servertime"]
    }
    
}

class SCNRankingIntegralListModels: Mappable {
    
    var integral: String?
    var mobile: String?
    
    init(){}
    
    required init?(map: Map) {
        mapping(map:map)
    }
    
    func mapping(map: Map) {
        
        
        integral <- map["integral"]
        mobile <- map["mobile"]
        
    }
    
}
